var path = require('path');
var fs = require('fs');
var co = require('co');

module.exports = function(app){
	function eachFiles(dir){
		fs.readdirSync(dir).forEach(function(name){
			if(path.extname(name)!==''){
				// console.log(path.join(dir,name));
				// console.log(require(path.join(dir,name)));
				require(path.join(dir,name))(app,co);
			}else if(name !== conf.exceptFolder &&name !== '.DS_Store'){
				eachFiles(path.join(dir, name));
			}
		})
	}
	eachFiles(conf.dir.controller);
}